﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Net.Http.Formatting;
using WebApiContrib.Formatting.Jsonp;

using Services.Common;
using Services.User;
using Services.Messages;
using Services.Business;
using Services.Activity;
using Services.PushNotification;
using Services.Form;

using WSServer;

namespace iShangMai
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            //GlobalConfiguration.Configuration.AddJsonpFormatter();

            Pusher.Init();

            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.USER, new ISMUserServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.FRIEND, new ISMFriendServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.BLACKLIST, new ISMBlacklistServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.PRIVATE_MESSAGES, new ISMPrivateMessageServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.BUSINESS,new ISMBusinessServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.ACTIVITIE, new ISMActivityServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.FORM, new ISMFormServiceProvider());
        }
    }
}
